<script>
$(function(){
	$("#tag_form").validate({
		errorClass: "wrong",
		rules: {
			txtTagname: {required:true,maxlength:6},
			txtTagsort: {required:true,number:true,min:0}
		},
		messages: {
			txtTagname: {required: "<tpl> $langShopTagNameCheck </tpl>",maxlength: "<tpl> $langShopTagNameMaxLength </tpl>"},
			txtTagsort: {required:"<tpl> $langShopTagSortCheck </tpl>",number:"<tpl> $langShopTagSortNumber </tpl>",min:"<tpl> $langShopTagSortSize </tpl>"}
		},
		submitHandler: function() {		
			if ($("#tag_type1").attr("checked")) {
				if ($("#txtTagcontent").val() == '') {
					$("#errTagcontent").show();
					$("#errTagcontent").html('<tpl> $langShopTagContentCheck </tpl>');
					return false;
				} else {
					$("#errTagcontent").hide();
					document.getElementById('tag_form').submit();
				}
			} else {
				if ($("#txtTagurl").val() == '') {
					$("#errTagurl").show();
					$("#errTagurl").html('<tpl> $langShopTagLinkCheck </tpl>');
					return false;
				} else {
					$("#errTagurl").hide();
					document.getElementById('tag_form').submit();
				}				
			}
		}
	});
})
</script>